import 'dart:io';

import 'package:dio/adapter.dart';
import 'package:dio/dio.dart';
import '../cache/SpUtil.dart';
abstract class NetHelp {

  static Dio dio;

  initIntercepter(Dio dio);

  setProxy() async {
    var ip = await SpUtil.instance.getSp("ip", "");
    var port = await SpUtil.instance.getSp("port", "");
    if (ip == "" || port == "") return;
    (dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
        (client) {
      client.findProxy = (uri) {
        return "PROXY $ip:$port";
      };
      client.badCertificateCallback =
          (X509Certificate cert, String host, int port) => true;
    };
  }

}

// To parse this JSON data, do
//
//     final baseModel = baseModelFromJson(jsonString);
